package com.yc.book.biz;

import java.sql.SQLException;
import java.util.Map;

import com.yc.book.dao.ReaderDao;

public class ReaderBiz {
	
	private ReaderDao dao = new ReaderDao();
	
	public Map<String,Object> login(String name, String pwd) throws BizException{
		//业务逻辑
		if(name == null || name.trim().isEmpty()) {
			throw new BizException("请填写用户名");
		}
		
		if(pwd == null || pwd.trim().isEmpty()) {
			throw new BizException("请填写密码");
		}
		
		try{
			Map<String,Object> reader = dao.selectForlogin(name, pwd);
			if(reader == null) {
				throw new BizException("用户名或密码错误");
				}
			return reader;
			}catch(SQLException e) {
				throw new BizException("业务异常请联系管理员",e);
			}
		
	

		
	}
}
